package io.kiki.sba.registry.common.model;

import io.kiki.sba.registry.common.model.store.Url;
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;


public interface Node extends Serializable {

    NodeType getNodeType();


    Url getUrl();


    enum NodeType {
        client, client_interface, central_control, data_store, console,
        ;

        public static NodeType codeOf(String type) {
            if (StringUtils.isBlank(type)) {
                return null;
            }
            for (NodeType nodeType : NodeType.values()) {
                if (StringUtils.containsIgnoreCase(type, nodeType.name())) {
                    return nodeType;
                }
            }
            return null;
        }
    }
}
